package com.better.frontend.controller.index;

import com.better.common.annotation.Log;
import com.better.common.base.ServiceResponse;
import com.better.common.utils.ServiceResponseHandle;
import com.better.frontend.Iservice.exam.ExamService;
import com.better.frontend.model.index.IndexParam;
import io.swagger.annotations.*;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 提供页面获取考试信息接口
 * Created by wfm on 2017/11/11.
 */
@Api(value = "考试信息管理", tags = {"考试管理操作接口"})
@RestController
@RequestMapping(path = "/api/exam")
public class IndexController {

    @Resource
    private ExamService examService;
    @Log("获取考试列表")
    @ApiOperation(value = "获取考试列表", notes = "根据用户信息获取相应的考试信息")
    @RequestMapping(value = "/getExam", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ServiceResponse<?> getExam(@RequestBody @Valid IndexParam examParam) {
        return ServiceResponseHandle.success(examService.getExmp(examParam));
    }

    @Log("按照学生和类型获取考试信息")
    @ApiOperation(value = "获取所有考试名称ID", notes = "获取所有考试名称ID")
    @RequestMapping(value = "/getAllExam", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ServiceResponse<?> getAllExam(@RequestBody @Valid IndexParam examParam) {
        return ServiceResponseHandle.success(examService.getAllExam(examParam));
    }
}
